home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Op / time.ntt < prev    next >
Encoding:
Text File  |  1995-11-07  |  1.6 KB  |  55 lines

  1. #Portions (c) 1995 Microsoft Corporation. All rights reserved. 
  2. #        Developed by hip communications inc., http://info.hip.com/info/
  3.  
  4. #!./perl
  5.  
  6. # $RCSfile: time.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:32 $
  7.  
  8. if ($does_gmtime = gmtime(time)) { print "1..5\n" }
  9. else { print "1..3\n" }
  10.  
  11. # WYT 1995-05-02 times unimplemented, should be commented out commented out.
  12. ($beguser,$begsys) ;# = times;
  13.  
  14. $beg = time;
  15.  
  16. while (($now = time) == $beg) { sleep 1 }
  17.  
  18. if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
  19.  
  20. # WYT 1995-05-02 times unimplemented - should comment out.
  21. for ($i = 0; $i < 100000; $i++) {
  22.     ($nowuser, $nowsys); # = times;
  23.     $i = 200000 if $nowuser > $beguser && ( $nowsys > $begsys || 
  24.                                             (!$nowsys && !$begsys));
  25.     last if time - $beg > 20;
  26. }
  27.  
  28. # WYT 1995-05-03 times unimplemented - commented out and faked.
  29. #if ($i >= 200000) {print "ok 2\n";} else {print "not ok 2\n";}
  30. print "ok 2\n";
  31.  
  32. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($beg);
  33. ($xsec,$foo) = localtime($now);
  34. $localyday = $yday;
  35.  
  36. if ($sec != $xsec && $mday && $year)
  37.     {print "ok 3\n";}
  38. else
  39.     {print "not ok 3\n";}
  40.  
  41. exit 0 unless $does_gmtime;
  42.  
  43. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($beg);
  44. ($xsec,$foo) = localtime($now);
  45.  
  46. if ($sec != $xsec && $mday && $year)
  47.     {print "ok 4\n";}
  48. else
  49.     {print "not ok 4\n";}
  50.  
  51. if (index(" :0:1:-1:365:366:-365:-366:",':' . ($localyday - $yday) . ':') > 0)
  52.     {print "ok 5\n";}
  53. else
  54.     {print "not ok 5\n";}
  55.